<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Jialeo\LaravelSchemaExtend\Schema;

class CreateFileTranscodingJobsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('file_transcoding_jobs', function (Blueprint $table) {
            $table->id();
            $table->string('jobId', 32)->default('')->comment('阿里云任务ID');
            $table->string('filePath', 120)->default('')->comment('文件路径');
            $table->string('model', 120)->default('')->comment('model命名空间');
            $table->string('updatedField', 32)->default('')->comment('更新的字段');
            $table->unsignedInteger('updatedModelId')->default(0)->comment('所更新表的主键');
            $table->string('filePathEncoded', 120)->default('')->comment('文件转码后路径');
            $table->smallInteger('status')->default(0)->comment('转码状态 0-未转码  1-已转码  2-转码失败');
            $table->unsignedInteger('createdAt')->default(0)->comment('创建时间');
            $table->unsignedInteger('updatedAt')->default(0)->comment('更新时间');
            $table->collation = 'utf8mb4_general_ci';
            $table->index('status', 'idxStatus');
            $table->comment = '文件转码任务表';
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('file_transcoding_jobs');
    }
}
